<template>
  <div>
    <el-select
      v-model="value"
      placeholder="可以选择内置文件"
      style="width: 240px"
    >
      <el-option
        v-for="(item, index) in gameItems"
        :key="index"
        :label="item.label"
        :value="item.url"
      />
    </el-select>
  </div>
</template>
<script setup lang="ts">
import { computed } from "vue";
import { gameItems } from "./game-list";

const props = defineProps<{
  modelValue?: string;
}>();

const emit = defineEmits<{
  (e: "update:modelValue", value: string): void;
}>();

const value = computed({
  get() {
    return props.modelValue;
  },
  set(val) {
    if (typeof val !== "string") return;
    emit("update:modelValue", val);
  },
});
</script>
